package game.engine.base.anim

import game.engine.base.Node
import game.engine.base.anim.composition.Parallel
import game.engine.base.anim.composition.Repeat
import game.engine.base.anim.single.*


//----------------------------
// move
fun Tween.moveTo(duration:Float,dstX:Float,dstY:Float):Tween{
    nextTween = MoveTo(duration,dstX,dstY)
    (nextTween as MoveTo).headTween = headTween
    return nextTween!!
}

fun Tween.moveBy(duration: Float,dx:Float,dy:Float):Tween{
    nextTween = MoveBy(duration,dx,dy)
    (nextTween as MoveBy).headTween = headTween
    return  nextTween!!
}

//----------------------------
// scale
fun Tween.scaleTo(duration:Float,dstSx:Float,dstSy:Float):Tween{
    nextTween = ScaleTo(duration,dstSx,dstSy)
    (nextTween as ScaleTo).headTween = headTween
    return nextTween!!
}
fun Tween.scaleBy(duration:Float,dxSx:Float,dxSy:Float):Tween{
    nextTween = ScaleBy(duration,dxSx,dxSy)
    (nextTween as ScaleBy).headTween = headTween
    return nextTween!!
}

//----------------------------
// rotate
fun Tween.rotateTo(duration: Float,dstDegress:Float):Tween{
    nextTween = RotateTo(duration,dstDegress)
    (nextTween as RotateTo).headTween = headTween
    return nextTween!!
}

fun Tween.rotateBy(duration: Float,dxDegress:Float):Tween{
    nextTween = RotateBy(duration,dxDegress)
    (nextTween as RotateBy).headTween = headTween
    return nextTween!!
}

//----------------------------
// delay
fun Tween.delay(t:Float):Tween{
    nextTween = Delay(t)
    (nextTween as Delay).headTween = headTween
    return nextTween!!
}

//----------------------------
// call
fun Tween.call(action: (Node) -> Unit):Tween{
    nextTween = Call(action)
    (nextTween as Call).headTween = headTween
    return  nextTween!!
}

//----------------------------
// parallel
fun Tween.parallel(vararg tween:Tween):Tween{
    nextTween = Parallel(*tween)
    (nextTween as Parallel).headTween = headTween
    return  nextTween!!
}


//----------------------------
// repeat
fun Tween.repeat(count:Int,tween:Tween):Tween{
    nextTween = Repeat(count,tween)
    (nextTween as Repeat).headTween = headTween
    return nextTween!!
}

